<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>菜单管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="../../../component/elementUI/index.css" />
    <link rel="stylesheet" href="../../../style/index.css" />
    <link rel="stylesheet" href="../../../component/pear/css/pear.css" />
  </head>

  <body>
    <div id="app" class="minWidth">
      <el-form :inline="true" :form="form">
        <el-form-item>
          <el-button type="primary" @click="addContract">添加</el-button>
        </el-form-item>
        <el-form-item>
          <el-select
            placeholder="请选择菜单等级"
            clearable
            filterable
            @change="onSerach"
            v-model.trim="form.level"
          >
            <el-option label="一级菜单" value="1"></el-option>
            <el-option label="二级菜单" value="2"></el-option>
            <el-option label="三级菜单" value="3"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-select
            placeholder="请选择菜单权限"
            clearable
            filterable
            @change="onSerach"
            v-model.trim="form.order"
          >
            <el-option label="全部" value="0"></el-option>
            <el-option label="仅平台" value="1"></el-option>
            <el-option label="仅用户" value="2"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-input
            placeholder="请输入菜单名称"
            clearable
            @change="onSerach"
            v-model.trim="form.Model_Name"
          ></el-input>
        </el-form-item>
      </el-form>

      <el-table
        :data="tableData"
        stripe
        border
        style="width: 100%"
        height="calc(100vh - 140px)"
      >
        <el-table-column
          align="center"
          label="序号"
          width="40"
          type="index"
        ></el-table-column>
        <el-table-column
          align="center"
          prop="Model_Number"
          width="80"
          label="菜单编号"
        ></el-table-column>
        <el-table-column
          align="center"
          prop="Model_Name"
          width="100"
          label="菜单名称"
        ></el-table-column>
        <el-table-column
          align="center"
          prop="Level"
          width="100"
          label="菜单等级"
        >
          <template v-slot="{row}"> {{Level(row.Level)}} </template>
        </el-table-column>
        <el-table-column
          align="center"
          prop="Parent_Name"
          width="100"
          label="父级菜单"
        ></el-table-column>
        <el-table-column prop="Url" label="菜单路由"></el-table-column>
        <el-table-column prop="Page_Name" label="包含页面(点击编辑)">
          <template v-slot="{row}">
            <el-tag
              style="cursor: pointer"
              v-if="row.System_Name"
              v-for="(item,index) in row.System_Name.split(' , ')"
              :key="index"
              >{{item}}</el-tag
            >
          </template>
        </el-table-column>
        <el-table-column align="center" prop="Icon" width="40" label="图标">
          <template v-slot="{row}">
            <i :class="row.Icon"></i>
          </template>
        </el-table-column>
        <el-table-column align="center" label="操作" width="180">
          <template v-slot="{row}">
            <el-button
              type="primary"
              size="small"
              @click="editMember(row.Model_Number)"
              >编辑</el-button
            >
            <el-dropdown size="small" trigger="click">
              <el-button size="small" type="primary">
                更多<i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item style="margin-bottom: 5px">
                  <el-button
                    type="danger"
                    size="small"
                    @click="deletMember(row.Model_Number)"
                    >删除</el-button
                  >
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
      </el-table>

      <el-pagination
        background
        v-show="total > 0"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="form.page"
        :page-sizes="[100,50,30,20,10]"
        :page-size="form.limit"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
      >
      </el-pagination>
      <add-form :visible.sync="dialog" :data="dialogData"></add-form>
    </div>
    <script
      type="text/javascript"
      src="../../../utils/jquery-3.6.0.min.js"
    ></script>
    <script
      type="text/javascript"
      src="../../../utils/jquery.cookie.js"
    ></script>
    <script type="text/javascript" src="../../../utils/vue.min.js"></script>
    <script
      type="text/javascript"
      src="../../../component/elementUI/index.js"
    ></script>
    <script type="text/javascript" src="../../../utils/utils.js"></script>
    <script type="text/javascript" src="js/Menu.js"></script>
  </body>
</html>
